home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / tclib20.zip / VIDEO.H < prev   
C/C++ Source or Header  |  1988-12-03  |  5KB  |  103 lines

  1. /* TCHK 2.0 - Howard Kapustein's Turbo C library       12-3-88 */
  2. /* Copyright (C) 1988, Howard Kapustein.  All rights reserved. */
  3.  
  4. /* video.h  -  header file for VIDEO.C - screen output routines */
  5.  
  6. #ifndef VIDEO_HEADER
  7. #define VIDEO_HEADER    1
  8.  
  9. #include <howard.h>
  10. #ifndef __VIDEO             /* can't check conio.h again, redefine #defines => errors */
  11. #include <conio.h>          /* struct text_info */
  12. #endif
  13.  
  14. /*  Remember, when #including files, <conio.h> MUST come before <video.h> */
  15.  
  16. #ifndef VIDEO
  17. #define VIDEO     0x10           /* VIDEO INTerrupt service = 16 (HEX 10) */
  18. #define MODE      *((byte far *) 0x449lu)          /* current video mode */
  19. #define PAGE      *((byte far *) 0x462lu)          /* current display page */
  20. #define PAGELEN   *((unsigned int far *) 0x44Clu)  /* current page length (regen buffer) */
  21. #define VIDOFFSET *((unsigned int far *) 0x44Elu)  /* offset from start of video */
  22. #define ROWCOUNT  *((byte far *) 0x484lu)          /* # rows minus 1 on display (EGA,PGA) */
  23. #define CHARHEIGHT *((unsigned int far *) 0x485lu) /* character height: # bytes/char, # scan lines/char (EGA,PGA) */
  24. #define CURSOR_UNDERBAR   (MODE==7)?0x0B0C:0x0607  /* cursor type: underbar (default) */
  25. #define CURSOR_HALFBLOCK  (MODE==7)?0x070C:0x0407  /* cursor type: half-block */
  26. #endif
  27.  
  28. /* Global variables */
  29. /* These have already been defined, they are just listed here for your
  30.    reference. Do not uncomment these variables.
  31.  
  32.    char frame1[11] = {'┌','─','┐','│','┘','─','└','│','\0','┤','├'};
  33.    char frame11[5] = {'┬','├','┴','┤','┼'};
  34.    char frame12[6] = {'╓','╞','╨','╡','╫','╪'};
  35.    char frame2[11] = {'╔','═','╗','║','╝','═','╚','║','\0','╣','╠'};
  36.    char frame21[6] = {'╤','╟','╧','╢','╪','╫'};
  37.    char frame22[5] = {'╦','╠','╩','╣','╬'};
  38.    char frame0[11] = {' ',' ',' ',' ',' ',' ',' ',' ','\0',' ',' '};
  39.    char framebox[11] = { '╒','═','╕','│','╛','═','╘','│','\0','╡','╞' };
  40.    const char emptystring[] = "               ";     /* 15 spaces */
  41.                                                                             */
  42.  
  43. /* video info */
  44. boolean isCGA(void);
  45. boolean isEGA(void);
  46. boolean isHerc(void);
  47. boolean isMDA(void);
  48. byte read_attrib(void);             /* read attribute at cursor */
  49. byte read_char(void);               /* read character at cursor */
  50. void settextinfo(struct text_info *inforec);    /* set TC info according to inforec */
  51. byte whatxy(byte *attrib);          /* read character/attribute at cursor */
  52.  
  53. /* video mode */
  54. void read_mode(byte *width, byte *mode, byte *page);
  55. void set_mode(byte mode);
  56.  
  57. /* line drawing */
  58. int box(int left, int top, int right, int bottom, char frame[]);
  59. void horiz_line(byte c, int len, int col, int row);     /* does not update cursor */
  60. void vert_line(byte c, int len, int col, int row);      /* updates cursor */
  61. int boxwindow(int left, int top, int right, int bottom, char frame[],
  62.               char *title, int titlejustify, char colborder, char coltitle,
  63.               char colnorm, char *buffer);
  64.  
  65. /* output */
  66. void putk(byte c);                          /* output 1 char w/attrib, BIOS */
  67. void putsay(int col, int row, byte *c);     /* direct screen writes */
  68. void putstr(byte *c);                       /* INTerrupt output */
  69.  
  70. /* text manipulation */
  71. void gotohv(int horiz, int vert);           /* goto x,y, absolute, not limited by TC 1.5 */
  72. int whereh(void);                           /* wherex(), absolute, not limited by TC 1.5 */
  73. int wherev(void);                           /* wherey(), absolute, not limited by TC 1.5 */
  74. void clear(int left, int top, int right, int bottom);
  75. void scroll_up(int left, int top, int right, int bottom);
  76. void scroll_down(int left, int top, int right, int bottom);
  77.  
  78. /* cursor control */
  79. void cursor_blink(boolean fast);
  80. void cursor_flip(unsigned int curs1, unsigned int curs2);   /* toggle cursor type */
  81. void cursor_off(void);
  82. void cursor_on(void);
  83. unsigned int read_cursor(int *col, int *row);  /* returns CX reg, scan lines */
  84. unsigned int getcursor(void);                  /* returns cursor scan lines */
  85. void setcursor(unsigned int cursor);           /* set cursor scan lines */
  86.  
  87. /* tchk video control */
  88. void set_color(byte colors);
  89.  
  90.  
  91. #ifndef VIDEO_DEFINES
  92. #define ismono()            isMDA()|isHerc()
  93. #define iscolor()           !ismono()
  94. #define scrbuff(l,t,r,b)    (b-t+1)*(r-l+1)*2   /* # rows * # cols * 2 */
  95. #define cls()               clrscr()            /* I prefer cls() to clrscr() */
  96. #define color(f,b)          (f|(b<<4))          /* fore/back ground color */
  97. #define set_cursor(h,l)     setcursor(h|l)      /* high and low scan lines */
  98. /*#define gotoxy(x,y)         gotohv(x,y)       uncomment this for my gotoxy(), see docs */
  99. #define VIDEO_DEFINES   1
  100. #endif
  101.  
  102. #endif              /* VIDEO_HEADER */
  103.